Pacemaker - Cluster Configuration for httpd
2011/06/18 |
Configure Clustering for httpd. Stop httpd on both Hosts.
This example shows to configure on the environment like follows.
(1) www01.srv.world ( eth0 [192.168.1.60], eth1 [10.0.0.60] ) (2) www02.srv.world ( eth0 [192.168.1.61], eth1 [10.0.0.61] )
This example uses eth0 for inter-connection and uses eth1 for service provider.
|
|
[1] |
Set Virtual IP Address first.
|
[2] | Enable server-status on httpd. Set it on both Hosts. |
[root@www01 ~]#
vi /etc/httpd/conf/httpd.conf # line 921-926: uncomment and chnage acceses permittion <Location /server-status> SetHandler server-status Order deny,allow Deny from all Allow from 127.0.0.1 10.0.0.0/24 </Location> |
[3] | Configure Clustering. Set it on a Host. |
[root@www01 ~]# crm configure crm(live)configure# primitive httpd ocf:heartbeat:apache \ > params configfile="/etc/httpd/conf/httpd.conf" \ > port="80" \ > op start interval="0s" timeout="60s" \ > op monitor interval="5s" timeout="20s" \ > op stop interval="0s" timeout="60s" crm(live)configure# group webserver vip httpd # create a group crm(live)configure# show # confirm settings node www01.srv.world node www02.srv.world primitive httpd ocf:heartbeat:apache \ params configfile="/etc/httpd/conf/httpd.conf" port="80" \ op start interval="0s" timeout="60s" \ op monitor interval="5s" timeout="20s" \ op stop interval="0s" timeout="60s" primitive vip ocf:heartbeat:IPaddr2 \ params ip="10.0.0.100" cidr_netmask="24" \ op start interval="0s" timeout="60s" \ op monitor interval="5s" timeout="20s" \ op stop interval="0s" timeout="60s" group webserver vip httpd property $id="cib-bootstrap-options" \ dc-version="1.1.2-f059ec7ced7a86f18e5490b67ebf4a0b963bccfe" \ cluster-infrastructure="openais" \ expected-quorum-votes="2" \ no-quorum-policy="ignore" \ stonith-enabled="false" rsc_defaults $id="rsc-options" \ resource-stickiness="INFINITY" \ migration-threshold="1"crm(live)configure# commit # enable settings crm(live)configure# exit bye |
[4] | Make sure status with crm_mon, then httpd starts on a Host. |
[root@www01 ~]# crm_mon ============ Last updated: Sun Jun 19 02:36:45 2011 Stack: openais Current DC: www01.srv.world - partition with quorum Version: 1.1.2-f059ec7ced7a86f18e5490b67ebf4a0b963bccfe 2 Nodes configured, 2 expected votes 1 Resources configured. ============ Online: [ www01.srv.world www02.srv.world ] Resource Group: webserver vip (ocf::heartbeat:IPaddr2): Started www01.srv.world httpd (ocf::heartbeat:apache): Started www01.srv.world |
[5] | Access to Virtual IP address, then active Host answers like follows. |
[6] | Stop httpd forcely on active Host, then swith to www02.srv.world an once like follows. |